<meta title="新增抢购" width="1000px" args="itemList"/>
<form s="valid,form,nda"
      id="form" class="form-horizontal p"
      method="post"
      action="api/flashSaleItem">
    <table class="table table-bordered table-striped table-condensed table-middle">
        <tr>
            <td style="width: 100px;">日期</td>
            <td  style="width: 200px;">
                <input autocomplete="off" type="text" s="datetimepicker" s-valid-error="require()"
                       class="form-control input-sm" placeholder="选择日期" name="date" />
            </td>
            <td style="width: 100px;">场次</td>
            <td>
                <select class="form-control input-sm" s="select"
                        s-select="{value: 'time'}"
                        s-build="S.get('/api/flashSaleItemSetting/seasonList')"
                        name="season">
                </select>
            </td>
        </tr>
    </table>
    <table class="table table-bordered table-striped table-condensed">
        <thead>
        <tr>
            <th>图片</th>
            <th>商品</th>
            <th>标签</th>
            <th>价格</th>
            <th>券值</th>
            <th>佣金</th>
            <th>返金额</th>
            <th>免单数</th>
            <th>级别限制</th>
            <th>平台</th>
            <th class="text-right">操作</th>
        </tr>
        </thead>
        <tbody s="loop" s-data="itemList">
        <tr s-loop-role="empty">
            <td colspan="12">暂无数据</td>
        </tr>
        <tr s-loop-role="row" s-check-role="i" s="datac" >
            <td s="tpl">
                <img src="{%=this.picUrl%}" style="max-width: 50px; max-height: 50px;" />
            </td>
            <td s="tpl" style="width: 400px;">
                <a href="{%=this.sourceItemUrl%}"
                   target="_blank" external style="max-width: 250px;">{%=this.title%}</a>
                <input autocomplete="off" type="text" class="form-control input-sm" placeholder="标语" name="slogan" />
                <input type="hidden" class="form-control input-sm" name="itemId" value="{%=this.id%}" />
            </td>
            <td>
                <input autocomplete="off" s-valid-error="require()" type="text" step="1" class="form-control input-sm" placeholder="标签" name="label" style="width: 100px;" />
            </td>
            <td name="price"></td>
            <td name="couponValue"></td>
            <td s="tpl">
                {%if(this.highCommission){%}
                <label class="label label-warning">{%=this.commissionRate%}%</label>
                {%}else{%}
                <label class="label label-info">{%=this.commissionRate%}%</label>
                {%}%}
            </td>
            <td>
                <input autocomplete="off" s-valid-error="require(),number()" type="number" step="1" class="form-control input-sm" placeholder="返钱" name="returnFee" />
            </td>
            <td>
                <input autocomplete="off" s-valid-error="require(),number()" type="number" step="1" class="form-control input-sm" placeholder="免单数" name="totalNum" />
            </td>
            <td>
                <select class="form-control input-sm" s="select"
                        name="userLevel"
                        s-build="S.get('/api/enum/valuesMap/core.enums.UserLevel')">
                </select>
            </td>
            <td name="ecomPlatTitle"></td>
            <td class="text-right" s="tpl">
                <a href="javascript:;" class="btn btn-default btn-xs" s-click="this.node.parent().parent().remove()">删除</a>
            </td>
        </tr>
        </tbody>
    </table>
</form>
<script type="text/javascript">
    S.meta.btns = [
        {
            name: "保存",
            style: "btn btn-primary",
            click: function() {
                return $form.submit().done(function(){
                    S.close(true);
                })
            }
        },
        {
            name: "关闭",
            style: "btn btn-default",
            click: function() {
                S.close();
            }
        }
    ]

</script>